package com.itheima.udp2;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.net.SocketException;

public class SendClient {

    public static void main(String[] args) throws IOException {
        //创建对象
        DatagramSocket ds = new DatagramSocket();
        //组织数据
        byte[] bytes = "雷猴啊".getBytes();
        //224.0.1.0~224.255.255.255
        //224.0.0.0~224.0.1.0
        DatagramPacket dp = new DatagramPacket(bytes, 0, bytes.length, InetAddress.getByName("224.0.1.0"), 10086);
        //发送数据
        ds.send(dp);
        //释放资源
        ds.close();

    }
}
